<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class AccountManagement extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'account_management';
    public function getAccountTypeColorAttribute() {
        $hash = md5($this->account_type); // 使用账户类型的哈希值作为基础

        // 使用哈希值的前六位作为 RGB 颜色的值
        $red = hexdec(substr($hash, 0, 2));
        $green = hexdec(substr($hash, 2, 2));
        $blue = hexdec(substr($hash, 4, 2));

        // 将 RGB 颜色值转换为十六进制表示
        $color = '#' . dechex($red) . dechex($green) . dechex($blue);

        return $color;
    }
    
}


